﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Result</title>
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
</head>
<body>
    <div>
        <div style="width:720px; height:690px;margin-left:340px;">
            <div style="width:720px;height:60px; background-color:#cef16a; position:fixed; width:720px; height:60px; left:340px; top:0%;">
                <label style="font-size:40px; margin-left:15px;" onclick="Back()"><</label>
                <label style=" margin-left:260px; font-size:20px; color:#ffffff;">个人中心</label>
                <label style=" margin-left:240px;"><img src="/images/house.jpg" alt="Alternate Text" style="width:36px; height:36px;" onclick="Homes()" /></label>
            </div>
            <div>
                <img src="/images/login4.jpg" alt="Alternate Text" style="width:720px; height:300px; margin-top:60px;" />
            </div>
            <div>
                <table>
                    <tr>
                        <td><input type="text" name="name" value="" id="UserName" placeholder="请输入手机号码" class="form-control" style=" margin-top:20px; width:600px; margin-left:50px;" /></td>
                    </tr>
                    <tr>
                        <td><input type="password" name="name" value="" id="UserPwd" placeholder="请输入登录密码" class="form-control" style=" margin-top:120px; width:600px; margin-left:50px; margin-top:30px;" /></td>
                    </tr>
                    <tr>
                        <td><input type="password" name="name" value="" id="UserYZM" placeholder="请输入验证码" class="form-control" style=" margin-top:120px; width:300px; margin-left:50px; margin-top:30px;" /><a href="javascript:;" id="get_mob_yzm_btn" style="margin-left:400px;"  >获取验证码</a></td>
                    </tr>

                </table>
                
                <input type="button" name="name" value="注册" onclick="Loginss()" class="btn btn-success" style="width:600px; margin-left:50px; margin-top:20px;" />
                
            </div>
        </div>
    </div>
    <script>
        var InterValObj;
        var curCount;
        //timer处理函数
        var SetRemainTime = function () {
            if (curCount == 0) {
                window.clearInterval(InterValObj);//停止计时器
                $("#get_mob_yzm_btn").removeAttr('disable');
                $("#get_mob_yzm_btn").text('重新发送验证码');
            }
            else {
                curCount--;
                $("#get_mob_yzm_btn").text(curCount+'s秒后重新获取');
            }
        }
        function Back()
        {
            location.href = "/HosClient/LoingInfo";
        }
        function Loginss()
        {
            alert("123");
            var mobile = $("#UserName").val();
            var pwd = $("#UserPwd").val();
            var yzm = $("#UserYZM").val();
            $.ajax({
                url: '/HosClient/Register',
                type: 'post',
                dataType: 'json',
                data: { phone: mobile, pwd: pwd, yzm: yzm },
                success: function (item) {
                    if (item.code == 1) {
                        alert(item.Message);
                    }
                    else {
                        alert(item.Message);
                    }
                    return;
                }
            });
        }
        $(document).on('click', '#get_mob_yzm_btn', function () {
            var mobile = $("#UserName").val();
            var pwd = $("#UserPwd").val();
            var yzm = $("#UserYZM").val();
            if (mobile == "") {
                alert("手机号不能为空");
            }
            else {
                if (InterValObj && curCount > 0) {
                    return;
                }
                curCount = 59;
                //设置but效果，开始计时
                $(this).attr('disable', 'true');
                $(this).text(curCount + 's后重新获取');
                InterValObj = window.setInterval(SetRemainTime, 1000);
                $.ajax({
                    url: '/HosClient/SendSms',
                    type: 'post',
                    dataType: 'json',
                    data: { phone: mobile, pwd: pwd, yzm: yzm },
                    success: function (item) {
                        if (item.data == 1) {
                            alert(item.Message, 3);
                        }
                        else {

                        }
                        return;
                    }
                });

            }
        });
    </script>
</body>
</html>
